#include<bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
int n;
string s,t; 
int check()
{
	for ( int i = 0 ; i < n ; i++ )if(s[i]=='0')return 0;
	return 1;
}
void solve()
{
	int ans=0;
	for ( int i = 0 ; i < n ; i++ )
	{
		if(t[i]=='0')
		{
			for ( int j = i+1 ; j < n ; j++ )
			{
				if(t[j]=='0')
				{
					i=j;
					break;
				}
			}
			ans++;
		}
	}
	cout << ans;
}
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	freopen("hard.in","r",stdin);
	freopen("hard.out","w",stdout);
	cin >> n >> s >> t;
	if(check())solve();
	return 0;
}//10
